//package web.Annotation.readbody;
//
//import javax.servlet.ReadListener;
//import javax.servlet.ServletInputStream;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletRequestWrapper;
//import java.io.BufferedReader;
//import java.io.ByteArrayInputStream;
//import java.io.IOException;
//import java.io.InputStreamReader;
//
//public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
//    public String _body;
//
//    public XssHttpServletRequestWrapper(HttpServletRequest request) throws IOException {
//        super(request);
//        StringBuffer sBuffer = new StringBuffer();
//        BufferedReader bufferedReader = request.getReader();
//        String line;
//        while ((line = bufferedReader.readLine()) != null) {
//            sBuffer.append(line);
//        }
//        _body = sBuffer.toString();
//
//    }
//
//    @Override
//    public ServletInputStream getInputStream() {
//        final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(_body.getBytes());
//        return new ServletInputStream() {
//            @Override
//            public int read() {
//                return byteArrayInputStream.read();
//            }
//
//            @Override
//            public boolean isFinished() {
//                return false;
//            }
//
//            @Override
//            public boolean isReady() {
//                return false;
//            }
//
//            @Override
//            public void setReadListener(ReadListener listener) {
//
//            }
//        };
//    }
//
//    @Override
//    public BufferedReader getReader() {
//        return new BufferedReader(new InputStreamReader(this.getInputStream()));
//    }
//}
//
